import Vue from 'vue';  
import VueRouter from 'vue-router';  
import EasyToolHome from '../../components/EasyToolHome.vue';  
import EasyToolLogin from '../../components/EasyToolLogin.vue';  
import EasyToolSubmit from '../../components/EasyToolSubmit.vue';
import EasyToolPreview from '../../components/EasyToolPreview.vue';

Vue.use(VueRouter);  
const originaPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originaPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
    mode: 'hash',
    routes: [
        {
            path: '/',
            redirect: '/home'
        },
        {
            path: '/home',
            name: 'home',
            component: EasyToolHome
        },
        {
            path: '/login',
            name: 'login',
            component: EasyToolLogin
        },
        {
            path: '/submit',
            name: 'submit',
            component: EasyToolSubmit
        },
        {
            path: '/preview',
            name: 'preview',
            component: EasyToolPreview
        }
    ]
})

export default router;